pull-local: Support --remote argument
authorColin Walters <walters@verbum.org>
Sat, 29 Jun 2013 15:44:26 +0000 (11:44 -0400)
committerColin Walters <walters@verbum.org>
Sat, 29 Jun 2013 17:00:42 +0000 (13:00 -0400)
For offline upgrades, pull-local can now write the refs into a
specific remote, rather than using the local heads.

src/ostree/ot-builtin-pull-local.c
tests/t0000-basic.sh

index f0c10df84ffe01fbb0f061490e8c783aa94ff9af..1f760db308fa6c1a200f42d230d2bf42e7dc8838 100644 (file)
 #include <unistd.h>
 #include <stdlib.h>
 
+static char *opt_remote;
+
 static GOptionEntry options[] = {
+  { "remote", 0, 0, G_OPTION_ARG_STRING, &opt_remote, "Add REMOTE to refspec", "REMOTE" },
   { NULL }
 };
 
@@ -310,8 +313,9 @@ ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GError **err
     {
       const char *name = key;
       const char *checksum = value;
-
-      if (!ostree_repo_write_ref (data->dest_repo, NULL, name, checksum, error))
+        
+      if (!ostree_repo_write_ref (data->dest_repo, opt_remote, name, checksum,
+                                  error))
         goto out;
     }
 
index a55c748cd0a7d0f35d627814738f391f73498d44..4943a916d8d6b27dd781ffc4fab752193dea4e72 100755 (executable)
@@ -19,7 +19,7 @@
 
 set -e
 
-echo "1..30"
+echo "1..31"
 
 . $(dirname $0)/libtest.sh
 
@@ -218,3 +218,11 @@ echo "ok subdir enoent"
 cd ${test_tmpdir}
 $OSTREE checkout test2 --allow-noent --subpath /enoent 2>/dev/null
 echo "ok subdir noent"
+
+cd ${test_tmpdir}
+mkdir repo3
+${CMD_PREFIX} ostree --repo=repo3 init
+${CMD_PREFIX} ostree --repo=repo3 pull-local --remote=aremote repo test2
+ostree --repo=repo3 rev-parse aremote/test2
+echo "ok pull-local with --remote arg"
+